<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>苏宁易购</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        #suning {
            width: 15rem;
            height: 13.6rem;
        }

        /* 头部部分开始 */
        .header {
            width: 15rem;
            height: 1.8rem;
            background-color: #ffc024;
            display: flex;
            align-items: center;

            /* 头部分类 */
            .sort {
                width: 1rem;
                height: 1.6rem;
                display: flex;
                flex-direction: column;
                align-items: center;
                margin: 0 0.5rem;

                /* 分类图片 */
                img {
                    width: 1rem;
                    height: 1rem;
                }

                /* 分类文字 */
                span {
                    width: 1rem;
                    height: 0.6rem;
                    font-size: 0.4rem;
                    margin-left: 0.2rem;
                    color: #fff;
                }
            }

            /* 搜索框 */
            .search {
                width: 11.3rem;
                height: 1.4rem;
                background-color: #fef2cc;
                border-radius: 0.7rem;
                display: flex;
                align-items: center;

                /* 搜索图标 */
                img {
                    width: 1rem;
                    height: 1rem;
                    margin-left: 0.4rem;
                }

                /* 搜索提示词 */
                span {
                    font-size: 0.6rem;
                    color: #000;
                }

            }

            /* 登录 */
            span {
                font-size: 0.5rem;
                color: #fff;
                margin-left: 0.3rem;
            }
        }

        /* 头部部分结束 */

        /* 轮播图部分开始 */

        .slideshow {
            width: 15rem;
            height: 5.6rem;

            /* 轮播图图片 */
            img {
                width: 100%;
                height: 100%;
            }
        }

        /* 轮播图部分结束 */

        /* 列表部分开始 */

       .list {
            width: 15rem;
            height: 6.2rem;
            display: flex;
            flex-wrap: wrap;
            padding-left: 0.1rem;

            /* 列表项 */
            li {
               width: 2.3rem;
               height: 2.5rem; 
               display: flex;
               flex-direction: column;
               align-items: center;
               justify-content: center;
               margin: 0.3rem;

               /* 列表项图片 */
               img {
                    width: 2.1rem;
                    height: 2.1rem;
               }
               /* 列表项文字 */
               span {
                    font-size: 0.5rem;
                    color: #000;
                    font-weight: bold;
               }
            }   
       }
    </style>
</head>

<body>
    <div id="suning">
        <!-- 头部部分 -->
        <div class="header">
            <!-- 头部分类 -->
            <div class="sort">
                <img src="./images/sort.png">
                <span>分类</span>
            </div>
            <!-- 搜索框 -->
            <div class="search">
                <img src="./images/search-img.png">
                <span>长江二桥</span>
            </div>
            <!-- 登录 -->
            <span class="login">登录</span>
        </div>
        <!-- 轮播图部分 -->
        <div class="slideshow">
            <img src="./images/slideshow-img.jpg">
        </div>
        <!-- 列表 -->
        <ul class="list">
            <li>
                <img src="./images/sphy.png">
                <span>长江二桥</span>
            </li>
            <li>
                <img src="./images/sphy.png">
                <span>长江二桥</span>
            </li>
            <li>
                <img src="./images/sphy.png">
                <span>长江二桥</span>
            </li>
            <li>
                <img src="./images/sphy.png">
                <span>长江二桥</span>
            </li>
            <li>
                <img src="./images/sphy.png">
                <span>长江二桥</span>
            </li>
            <li>
                <img src="./images/sphy.png">
                <span>长江二桥</span>
            </li>
            <li>
                <img src="./images/sphy.png">
                <span>长江二桥</span>
            </li>
            <li>
                <img src="./images/sphy.png">
                <span>长江二桥</span>
            </li>
            <li>
                <img src="./images/sphy.png">
                <span>长江二桥</span>
            </li>
            <li>
                <img src="./images/sphy.png">
                <span>长江二桥</span>
            </li>
        </ul>
    </div>

    <script>
        function setHtmlFontSize() {
            // 1. 获取设备宽度大小
            let visual = document.documentElement.clientWidth
            // 2. 视口宽度不能超过750
            visual = visual > 750 ? 750 : visual
            // 3. 除以15份，将每份作为root根元素的字体大小
            document.documentElement.style.fontSize = visual / 15 + 'px'
        }

        window.onload = function () {
            setHtmlFontSize()
        }

        window.onresize = function () {
            setHtmlFontSize()
        }
    </script>
</body>

</html>